//
//  DYJiangjieCell.swift
//  SheYangBigData
//
//  Created by 宋海胜 on 2020/12/31.
//  Copyright © 2020 叁拾叁. All rights reserved.
//


import UIKit

class DYJiangjieCell: SYBaseCell {

    fileprivate var bgView: UIView = {
        let v: UIView = UIView()
        v.backgroundColor = .white
        v.layer.cornerRadius = 5
        return v
    }()
    
    let titleLb: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x1A1A1A)
        v.font = 17.autoBoldFontSize()
        
        return v
    }()
    
    let timeLb: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x999999)
        v.font = 14.autoFontSize()
        
        return v
    }()
    
    let pic: UIImageView = {
        let v: UIImageView = UIImageView()
        
        return v
    }()

    public func configureView(_ model: DYJQJIangjieListModel) {
        titleLb.text = model.name
        timeLb.text = model.duration
        pic.sy_setWithUrl(model.imgUrl)
        
    }
    
    override func initViews() {
        self.backgroundColor = UIColor(hex: 0xF2F2F2)
        addSubview(bgView)
        bgView.addSubview(titleLb)
        bgView.addSubview(timeLb)
        bgView.addSubview(pic)
        bgView.snp.makeConstraints { (make) in
            make.top.equalToSuperview()
            make.left.equalToSuperview().offset(autoWidth(15.0))
            make.right.equalToSuperview().offset(autoWidth(-15.0))
            make.bottom.equalToSuperview().offset(-17.5.autoWidth())
        }
        titleLb.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(autoWidth(17.5))
            make.left.equalTo(pic.snp.right).offset(10.0.autoWidth())
            make.right.equalToSuperview().offset(-17.0.autoWidth())
            
        }
        timeLb.snp.makeConstraints { (make) in
            make.bottom.equalTo(pic.snp.bottom).offset(autoWidth(-17.5))
            make.height.equalTo(12.0.autoWidth())
            make.left.equalTo(titleLb.snp.left)
        }
        pic.snp.makeConstraints { (make) in
            make.top.equalToSuperview()
            make.left.equalToSuperview()
            make.height.equalTo(85.0.autoWidth())
            make.width.equalTo(85.0.autoWidth())
            make.bottom.equalToSuperview()
        }
    }
}

